package gui;

import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.WindowConstants;


public class guiWSU extends JFrame {
	public static menuBar jMenuBar1 = new menuBar();

	public static MyDesktopPane jDesktopPane1 = new MyDesktopPane();
	public static JInternalFrame jInternalFrame1 = new gui0_1().frame();
	public static JInternalFrame jInternalFrame2 = new gui0_2().frame();

	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				new guiWSU().setVisible(true);
			}
		});
	}

	public guiWSU() {
		initComponents();
		menuBarActionListener.ActionListener();
	}

	private void initComponents() {
		setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
		setIconImage(new ImageIcon(getClass().getResource("/icons/logoIcon_32.png")).getImage()); 
		setTitle(lang.lang.getLang(0,0));

		setSize(800,500);
		setLocationRelativeTo(null);
		
		setJMenuBar(jMenuBar1.menuBar());

		jDesktopPane1.add(jInternalFrame1).setVisible(false);
		jDesktopPane1.add(jInternalFrame2).setVisible(false);

		GroupLayout layout = new GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(
				GroupLayout.Alignment.LEADING).addComponent(jDesktopPane1,
				GroupLayout.DEFAULT_SIZE, 787, Short.MAX_VALUE));
		layout.setVerticalGroup(layout.createParallelGroup(
				GroupLayout.Alignment.LEADING).addComponent(jDesktopPane1,
				GroupLayout.DEFAULT_SIZE, 574, Short.MAX_VALUE));
		//pack();
	}
}

class MyDesktopPane extends JDesktopPane {
	Image img;

	public MyDesktopPane() {
		try {
			java.net.URL caminho = guiWSU.class
					.getResource("/image/logo_700x233.png");
			img = javax.imageio.ImageIO.read(caminho);
		} catch (Exception e) {
		}
	}

	public void paintComponent(Graphics g) {
		super.paintComponent(g);
		if (img != null)
			g.drawImage(img, ((this.getWidth() / 2) - 350),
					((this.getHeight() / 2) - 116), 700, 233, this);
		else
			g.drawString(lang.lang.getLang(0,1), ((this.getWidth() / 2) - 68),
					((this.getHeight() / 2) + 4) );
	}
}
